<?php

class Adept_Validate_Email extends Adept_Validate_Abstract implements Adept_Validate_IValidator {
    
    public function validate($sender, $value)
    {
        if (!preg_match(
            "/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/",
            $value)) {
            $title = ($sender instanceof Adept_Component_Control) ? $sender->getTitle() : '';
            throw new Adept_Validate_Exception('NOT_VALID_EMAIL', 0, array('value' => $value, 'field' => $title));
        }
    }
    
    public function setAttributes($attributes) {
        
    }
    
}

